package com.lagou.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @author Nocturne
 * @date 2021/5/10 0:10
 * @description SpringBoot + Mybatis实现动态数据源切换
 * 3. 创建AbstractRoutingDataSource的子类，重写determineCurrentLookupKey()方法{return "master"}
 */
public class RoutingDataSource extends AbstractRoutingDataSource {
	@Override
	protected Object determineCurrentLookupKey() {
		return RoutingDataSourceContext.getDataSourceRoutingKey();
	}
}
